@extends('app')

@section('content')
<link rel="stylesheet" type="text/css" href="{{ asset('/jquery-date/dateRange.css') }}" />
<script src="{{ asset('/jquery-date/dateRange.js') }}" type="text/javascript"></script>

<!-- 私信列表 模态框 -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="exampleModalLabel">私信详情</h4>
      </div>
      <div class="modal-body">
        <div class="widget-box ">
            <div class="widget-header">
                <h4 class="lighter smaller">
                    <i class="icon-comment blue"></i>
                    会话
                </h4>
            </div>

            <div class="widget-body">
                <div class="widget-main no-padding">
                    <div class="slimScrollDiv" style="">
                        <div class="dialogs" style="">
                        <div class="itemdiv dialogdiv">
                            <div class="user">
                                <img alt="Alexa's Avatar" src="{{ asset('/images/admin/avatar1.png') }}">
                            </div>

                            <div class="body">
                                <div class="time">
                                    <i class="icon-time"></i>
                                    <span class="green">4秒钟前</span>
                                </div>

                                <div class="name">
                                    <a href="#">Alexa</a>
                                </div>
                                <div class="text">大家好啊</div>

                                <div class="tools">
                                    <a href="#" class="btn btn-minier btn-info">
                                        <i class="icon-only icon-share-alt"></i>
                                    </a>
                                </div>
                            </div>
                        </div>

                        <div class="itemdiv dialogdiv">
                            <div class="user">
                                <img alt="John's Avatar" src="{{ asset('/images/admin/avatar.png') }}">
                            </div>

                            <div class="body">
                                <div class="time">
                                    <i class="icon-time"></i>
                                    <span class="blue">38秒以前</span>
                                </div>

                                <div class="name">
                                    <a href="#">John</a>
                                </div>
                                <div class="text">框架很好用嘛</div>

                                <div class="tools">
                                    <a href="#" class="btn btn-minier btn-info">
                                        <i class="icon-only icon-share-alt"></i>
                                    </a>
                                </div>
                            </div>
                        </div>

                        <div class="itemdiv dialogdiv">
                            <div class="user">
                                <img alt="Bob's Avatar" src="{{ asset('/images/admin/user.jpg') }}">
                            </div>

                            <div class="body">
                                <div class="time">
                                    <i class="icon-time"></i>
                                    <span class="orange">2分钟以前</span>
                                </div>

                                <div class="name">
                                    <a href="#">Bob</a>
                                    <span class="label label-info arrowed arrowed-in-right">admin</span>
                                </div>
                                <div class="text">欢迎大家使用ACE后台管理系统.</div>

                                <div class="tools">
                                    <a href="#" class="btn btn-minier btn-info">
                                        <i class="icon-only icon-share-alt"></i>
                                    </a>
                                </div>
                            </div>
                        </div>

                        <div class="itemdiv dialogdiv">
                            <div class="user">
                                <img alt="Jim's Avatar" src="{{ asset('/images/admin/avatar4.png') }}">
                            </div>

                            <div class="body">
                                <div class="time">
                                    <i class="icon-time"></i>
                                    <span class="grey">3分钟以前</span>
                                </div>

                                <div class="name">
                                    <a href="#">Jim</a>
                                </div>
                                <div class="text">大家多提提BUG</div>

                                <div class="tools">
                                    <a href="#" class="btn btn-minier btn-info">
                                        <i class="icon-only icon-share-alt"></i>
                                    </a>
                                </div>
                            </div>
                        </div>

                        <div class="itemdiv dialogdiv">
                            <div class="user">
                                <img alt="Alexa's Avatar" src="{{ asset('/images/admin/avatar1.png') }}">
                            </div>

                            <div class="body">
                                <div class="time">
                                    <i class="icon-time"></i>
                                    <span class="green">4分钟以前</span>
                                </div>

                                <div class="name">
                                    <a href="#">Alexa</a>
                                </div>
                                <div class="text">继续支持ACE后台系统</div>

                                <div class="tools">
                                    <a href="#" class="btn btn-minier btn-info">
                                        <i class="icon-only icon-share-alt"></i>
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                </div><!-- /widget-main -->
            </div><!-- /widget-body -->
        </div><!-- /widget-box -->
      </div>
    </div>
  </div>
</div>
<!--<ul class="nav nav-tabs">
    <li class="active"><a href="{{ url('/admin/organization/class/index')}}">信息列表</a></li>
</ul>-->

<div class="container-fluid">
    <div class="row-fluid">
        <div class="span12">
            <div class="tabbable" id="tabs-876069">
                <ul class="nav nav-tabs">
                    <li class="active">
                        <a href="#panel-656128" data-toggle="tab">用户私信</a>
                    </li>
                    <li>
                        <a href="#panel-952476" data-toggle="tab">搜索</a>
                    </li>
                </ul>
                <div class="tab-content">
                    <!--列表开始-->
                    <div class="tab-pane active" id="panel-656128">
                        <h5 class="sub-header"></h5>
                        <div class="table-responsive">
                            <table class="table table-striped">
                                <thead>
                                <tr>
                                    <th><input id="checkAll" type="checkbox" value=""></th>
                                    <th>发送者</th>
                                    <th>接收者</th>
                                    <th>内容</th>
                                    <th>状态</th>
                                    <th>发送时间</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($inboxs as $res)
                                <tr id="news_{{ $res->id }}">
                                    <td><input type="checkbox" name="inboxs" value="{{ $res->id }}"></td>
                                    <td>{{ $res->userinfo->name }}</td>
                                    <td>{{ $res->receiptinfo->name }}</td>
                                    <td>{{ $res->message }}</td>
                                    <td>@if($res->semder_remove == 0 AND $res->recipient_remove == 0)
                                        <span class="label label-info arrowed-right arrowed-in">正常</span>
                                        @elseif ($res->semder_remove == 1)
                                        <span class="label label-danger arrowed">发送者已移除</span>
                                        @elseif ($res->recipient_remove == 1)
                                        <span class="label label-success arrowed-in arrowed-in-right">接收者已移除</span>
                                        @endif
                                    </td>
                                    <td>{{ $res->created_at }}</td>
                                    <td>
                                        <!-- <a href="{{ url('/admin/organization/class/edit/'.$res->id) }}"><i class="glyphicon glyphicon-edit"></i></a>&nbsp;&nbsp;&nbsp;&nbsp; -->
                                        <a href="javascript:void(0);" onclick="del_one('/admin/users/message/delete','{{$res->id}}','{{ csrf_token() }}')"><i class="glyphicon glyphicon-remove-sign"></i></a>
                                    </td>
                                </tr>
                                @endforeach
                                </tbody>
                            </table>
                        </div>
                        <div>
                            <a class="btn btn-danger" onclick="batch_del('/admin/users/message/deletes','{{ csrf_token() }}', 'id', 'inboxs'); ">
                                <i class="icon-trash icon-large"></i>
                                删除
                            </a>
                        </div>
                        <div>{!! $inboxs->render() !!} </div>
                    </div>
                    <!--列表结束-->

                    <!--搜索开始-->
                    <div class="tab-pane " id="panel-952476">
                        <div style="width: 95%;margin: auto;padding-top: 40px;">
                            <div style="width: 50%;float: left;">
                                <form class="form-horizontal" action="/admin/users/message" method="get">
                                    <div class="form-group">
                                        <label for="inputEmail3" class="col-sm-2 control-label">关键字:</label>
                                        <div class="col-sm-10 pad-t-12">
                                            <input type="text" name="keywords" class="form-control" placeholder='请输入关键字'>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="inputEmail3" class="col-sm-2 control-label">发送者:</label>
                                        <div class="col-sm-10 pad-t-12">
                                            <input type="radio" name="semder_remove" id="" class="form-control" checked="checked" value="0">正常
                                            <input type="radio" name="semder_remove" id="" class="form-control" value="1">已移除
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label for="inputEmail3" class="col-sm-2 control-label">接收者:</label>
                                        <div class="col-sm-10 pad-t-12">
                                            <input type="radio" name="recipient_remove" id="" class="form-control" checked="checked" value="0">正常
                                            <input type="radio" name="recipient_remove" id="" class="form-control" value="1">已移除
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="inputPassword3" class="col-sm-2 control-label">时间段:</label>
                                        <div class="col-sm-10 pad-t-10" >
                                          <div class="ta_date" id="div_date1">
                                              <span class="date_title" id="date1"></span>
                                              <a class="opt_sel" id="input_trigger1" href="#">
                                                  <i class="i_orderd"></i>
                                              </a>
                                          </div>
                                        <div id="datePicker1"></div>
                                    </div>
                                    </div>
                                    {!! csrf_field() !!}
                                    <input type="hidden" name="inbox_at_start" value="" />
                                    <input type="hidden" name="inbox_at_end" value="" />
                                    <div class="form-group">
                                        <div class="col-sm-offset-2 col-sm-10">
                                            <button type="submit" class="btn btn-primary">搜索</button>
                                        </div>
                                    </div>
                                </form>
                            </div>

                        </div>
                    </div>
                    <!--搜索结束-->
                </div>
            </div>
        </div>
    </div>
</div>


<script type="text/javascript">

    $(document).ready(function(){
        // 鼠标滑过出现提示
        $('[data-toggle="tooltip"]').tooltip();
        /*复选框样式*/
        $('input').iCheck({
            checkboxClass: 'icheckbox_flat-blue',
            radioClass: 'iradio_flat-blue',
            increaseArea: '-10' // optional
        });

        /*全选*/
        $('#checkAll').on('ifClicked', function(event){
            $('input[name="comments"]').iCheck('check');
        });

        // 初始化 隐藏域的日期参数
        $('input[name="inbox_at_start"]').val(start);
        $('input[name="inbox_at_end"]').val(end);
    });

    // 日期选择
  var start = showTime(-1); //当前日期前1天日期
  var end = showTime(1); //当前日期
  var dateRange1 = new pickerDateRange('date1', {
                isTodayValid: false,
                startDate: start,
                endDate: end,
                needCompare: false,
                defaultText: ' 至 ',
                autoSubmit: true,
                inputTrigger: 'input_trigger1',
                theme: 'ta',
                success: function (obj) {
                    $("#dCon2").html('开始时间 : ' + obj.startDate + '<br/>结束时间 : ' + obj.endDate);
                    $('input[name="inbox_at_start"]').val(obj.startDate);
                    $('input[name="inbox_at_end"]').val(obj.endDate);
                }
            });
</script>
@endsection


















